package com.book.deprecated.state;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DeprecatedOrderContext {
    private DeprecateAbstractOrderState currentState;

    @Autowired
    private DeprecatedCreateOrder deprecatedCreateOrder;

    /**
     * 设置订单状态
     * @param currentState
     */
    public void setCurrentState(DeprecateAbstractOrderState currentState){
        this.currentState=currentState;
    }

    public DeprecatedOrder createOrder(String orderId,String productId){
        DeprecatedOrder order = currentState.createOrder(orderId, productId, this);
        return order;
    }

      public DeprecatedOrder payOrder(String orderId,String productId){
        DeprecatedOrder order = currentState.payOrder(orderId, this);
        return order;
    }

      public DeprecatedOrder sendOrder(String orderId ){
        DeprecatedOrder order = currentState.sendOrder(orderId,  this);
        return order;
    }

      public DeprecatedOrder receiveOrder(String orderId ){
        DeprecatedOrder order = currentState.receiveOrder(orderId, this);
        return order;
    }



}
